=======================================================================================================================================
Title: Custom Field Template

Version: 1.0

Author: John Briggs

Description:
This modification will provide an additional field to your profile and threads.

Copyright:  2009 John Briggs. All rights reserved.

Compatibility: XMB 1.9.8 SP4

Install Note: Before adding this modification to your forum you should back up all files related to this modification.

License Note: This modification is released under the GPL v3 License. A copy is provided with this software package.

Author Note: This modification is developed and released for use with XMB 1.9.8 SP4 which is provided by XMBGarage.com.

=======================================================================================================================================
=======
How To:
=======

This is a basic template on how to create a new custom field of your choice.

1] First thing to do is to replace all instances of the word "stuff" (without quotes) with the name of your choice.
A example of how to replace the word "stuff" with a new name is if you want to make a new field named state then you
would replace all instances of the word "stuff" with the word "state".

2] Once you have done this you want to make sure the language variable uses the description you desire. Look for this code
$lang['stuff'] = "Stuff:"; and make sure you apply #1 to it as well.

3] Make sure that the SQL insert is also adjusted according to what #1 explains.

============================================================================================================================
=======
Step 1:
=======
==============================
Go To Admin Panel --> Insert Raw SQL
==============================
==========================
Paste Code Below & Click Submit:
==========================

ALTER TABLE `$table_members` ADD `stuff` varchar(75) NOT NULL default '';

============================================================================================================================
=======
Step 2:
=======
===================
Edit File: editprofile.php
===================
==========
Find Code:
==========

    $sig = postedVar('newsig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

    // Custom Field: Stuff Mod Begin
    $newstuff = postedVar('newstuff', 'javascript', TRUE, TRUE, TRUE);
    // Custom Field: Stuff Mod End


==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET status='$status',

========================================
Find Code In-Line At End Of Above Query Statement:
========================================

 WHERE username='$user'");

================
Replace Code With:
================

, stuff='$stuff' WHERE username='$user'");

============================================================================================================================
=======
Step 3:
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

loadtemplates(

===============
Add Code Below:
===============

loadtemplates(
'member_profile_stuff',

==========
Find Code:
==========

                $sig = postedVar('sig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

                // Custom Field: Stuff Mod Begin
                $stuff = postedVar('stuff', 'javascript', TRUE, TRUE, TRUE);
                // Custom Field: Stuff Mod End

============================
Find Code On 1st Occurrence:
============================

$db->query("INSERT INTO ".X_PREFIX."members (username,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('$username',

==================
Replace Code With:
==================

, stuff) VALUES ('$username',

==================================
Find Code At End Of Above Query Statement:
==================================

)");

================
Replace Code With:
================

, '$stuff')");

========================
Find Code On 2nd Occurrence:
========================

$db->query("INSERT INTO ".X_PREFIX."members (username,

=============================
Find Code In-Line In Above Statement:
=============================

) VALUES ('$username',

================
Replace Code With:
================

, stuff) VALUES ('$username',

==================================
Find Code At End Of Above Query Statement:
==================================

)");

================
Replace Code With:
================

, '')");

==========
Find Code:
==========

        $emailblock = '';
        if ($memberinfo['showemail'] == 'yes') {
            eval('$emailblock = "'.template('member_profile_email').'";');
        }

===============
Add Code Below:
===============

        // Custom Field: Stuff Mod Begin
        $stuffblock = '';
        if (!empty($memberinfo['stuff'])) {
            $memberinfo['stuff'] = censor($memberinfo['stuff']);
            eval('$stuffblock = "'.template('member_profile_stuff').'";');
        }
        // Custom Field: Stuff Mod End

============================================================================================================================
=======
Step 4:
=======
=================
Edit File: memcp.php
=================

==========
Find Code:
==========

        $sig = postedVar('newsig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

        // Custom Field: Stuff Mod Begin
        $newstuff = postedVar('newstuff', 'javascript', TRUE, TRUE, TRUE);
        // Custom Field: Stuff Mod End

==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET $pwtxt email='$email',

========================================
Find Code In-Line At End Of Above Query Statement:
========================================

 WHERE username='$xmbuser'");

================
Replace Code With:
================

, stuff='$stuff' WHERE username='$xmbuser'");

============================================================================================================================
=======
Step 5:
=======
====================================================
Skip This Step If You Do Not Want This Field To Display In Viewthread.
====================================================
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }

===============
Add Code Below:
===============

            // Custom Field: Stuff Mod Begin
            $stuff = '';
            if (!empty($post['stuff'])) {
                $post['stuff'] = censor($post['stuff']);
                $stuff = '<br /><strong>'.$lang['stuff'].'</strong> '.$post['stuff'];
            }
            // Custom Field: Stuff Mod End

==========
Find Code:
==========

            $location = '';
            $mood = '';

===============
Add Code Below:
===============

            // Custom Field: Stuff Mod Begin
            $stuff = '';
            // Custom Field: Stuff Mod End

============================================================================================================================
=======
Step 6:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of Fild Above ?>
============================

// Custom Field: Stuff Mod Begin
$lang['stuff'] = "Stuff:";
// Custom Field: Stuff Mod End

============================================================================================================================
=======
Step 7:
=======
==========================
Go To Admin Panel --> Templates
==========================
===========================
Edit Template: admintool_editprofile
===========================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[textlocation]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newlocation" size="25" value="$member[location]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newstuff" size="25" value="$member[stuff]" /></td>
</tr>

============================================================================================================================
=======
Step 8:
=======

==========================
Go To Admin Panel --> Templates
==========================
===========================
Edit Template: member_reg_optional
===========================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[textlocation]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="location" size="25" value="" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="stuff" size="25" value="" /></td>
</tr>

============================================================================================================================
=======
Step 9:
=======
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: memcp_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[textlocation]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newlocation" size="25" value="$member[location]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newstuff" size="25" value="$member[stuff]" /></td>
</tr>

============================================================================================================================
========
Step 10:
========
====================================================
Skip This Step If You Do Not Want This Field To Display In Viewthread.
====================================================
==========================
Go To Admin Panel --> Templates
==========================
========================
Edit Template: viewthread_post
========================
==========
Find Code:
==========

$location

===============
Add Code Below:
===============

$stuff

============================================================================================================================
========
Step 11:
========
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]">$lang[textlocation]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[location]</td>
</tr>

===============
Add Code Below:
===============

$stuffblock

============================================================================================================================
========
Step 12:
========
==========================
Go To Admin Panel --> Templates
==========================
=================================
Create New Template: member_profile_stuff
=================================
=====================
Add Code &  Click Submit:
=====================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[stuff]</td>
</tr>

============================================================================================================================
Enjoy!